package com.example.control;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/stock")
public class stockController {

    @Resource
    private RestTemplate restTemplate;

    @Value("${server.port}")
    private String port;

    @RequestMapping(value = "/deduct.json")
    @ResponseBody
    public String deduct() {
        System.out.println("扣减库存！");
        return port;
    }

    @RequestMapping(value = "/getPort.json")
    @ResponseBody
    public String getPort() {
        int i =1/0;
        System.out.println("getPort！" + i);
        return port;
    }
}
